<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数字比较</title>
</head>

<body>
    <h2>比较三个数字的大小</h2>
    <input type="number" id="num1" placeholder="输入第一个数字">
    <input type="number" id="num2" placeholder="输入第二个数字">
    <input type="number" id="num3" placeholder="输入第三个数字">
    <button onclick="compareNumbers()">比较</button>
    <p id="result"></p>

    <script>
        function compareNumbers() {
            const num1 = parseFloat(document.getElementById('num1').value);
            const num2 = parseFloat(document.getElementById('num2').value);
            const num3 = parseFloat(document.getElementById('num3').value);

            const numbers = [num1, num2, num3];
            numbers.sort((a, b) => a - b);

            document.getElementById('result').textContent = `从小到大排序为: ${numbers.join(', ')}`;
        }
    </script>
</body>

</html>
    